package com.java.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.java.dao.HelpMapper;
import com.java.model.Help;
import com.java.service.HelpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HelpServiceImpl implements HelpService {

    @Autowired
    private HelpMapper helpMapper;

    @Override
    public PageInfo<Help> list(Help help){
        PageHelper.startPage(help.getPageNum(),help.getPageSize());
        List<Help> list = helpMapper .list(help);
        return new PageInfo<>(list);
    }

    @Override
    public void save(Help help) {
        helpMapper.save(help);
    }

    @Override
    public Help get(int id) {
        return helpMapper.get(id);
    }
    @Override
    public void modify(Help help) {
        helpMapper.modify(help);
    }

    @Override
    public void remove(int[] ids) {
        for (int id:ids){
            helpMapper.remove(id);
        }
    }
}
